package br.edu.utfpr.backupTools.view.action.strategy.impl;

import br.edu.utfpr.backupTools.model.pojo.Backup;
import br.edu.utfpr.backupTools.rmi.ClienteRmi;
import br.edu.utfpr.backupTools.view.action.strategy.AbstractBackup;
import br.edu.utfpr.backupTools.view.action.strategy.iterfaces.VerificaBackup;
import br.edu.utfpr.comum.BackupDTO;

import java.rmi.RemoteException;

public class VerificaBackupRemoto extends AbstractBackup implements VerificaBackup{

    @Override
    public boolean possuiBackup(Backup bean) {
        BackupDTO dto = new BackupDTO(bean.getId(), bean.getDescricao(), bean.getOrigem(), bean.getDestino());
        try {
            return ClienteRmi.getInstance().provider().possuiBackup(dto);
        } catch (RemoteException e) {
            e.printStackTrace();
            return false;
        }
    }
}
